<script setup>
import {ref} from "vue";
import {Search} from "@element-plus/icons-vue";
import {useCounterStore} from "@/stores/counter.js";
import router from "@/router/index.js";

const setUserStore=useCounterStore()
const embark=ref()
const destination=ref()
const date=ref()
const getData=()=>{
  setUserStore.setPlaneAreaName1(embark.value)
  setUserStore.setPlaneAreaName2(destination.value)
  setUserStore.setPlaneDate(date.value)
  router.push("/planeSearch")
}
</script>

<template>
  <div class="ticket">
    <div class="header">国内机票</div>
    <div class="choose">
      <div class="choose-city">
        <div>
          <div class="text">出发地</div>
          <div><el-input v-model="embark" style="width: 160px;height: 34px" placeholder="可输入城市" /></div>
        </div>
        <div>
          <div class="text">目的地</div>
          <div><el-input v-model="destination" style="width: 160px;height: 34px" placeholder="可输入城市" /></div>
        </div>
      </div>
      <div class="choose-date">
        <div class="text">出发日期</div>
        <div><el-date-picker style="width: 365px;height: 34px" v-model="date" type="date" placeholder="选择出发日期" value-format="YYYY-MM-DD"/></div>
      </div>
      <div class="button">
        <button @click="getData"><el-icon><Search/></el-icon>搜索</button>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.ticket{
  width: 410px;
  height: 300px;
  border-radius: 2px;
  background: #fff;
  .header{
    color: #333;
    font-weight: 500;
    font-size: 16px;
    line-height: 40px;
    text-indent: 2em;
    background: #efeff4;
  }
  .choose{
    .text{
      line-height: 25px;
      font-size: 14px;
      color: #b2b2b2;
    }
    .choose-city{
      display: flex;
      justify-content: space-around;
      margin-top: 20px;
    }
    .choose-date{
      margin-left: 22.5px;
      margin-top: 20px;
    }
    .button{
      margin-top: 30px;
      i{
        vertical-align: middle;
        margin-right: 5px;
      }
       button{
        background: #ff6257;
        width: 365px;
        height: 40px;
        margin-left: 22.5px;
        border: none;
        cursor: pointer;
         transition: .2s;
         border-radius: 3px;
         color: #fff;
         font-weight: 700;
         font-size: 18px;
      }
      button:hover{
        box-shadow: rgba(0,0,0,.2) 0 0 10px;
      }
    }
  }
}
</style>